Imaging Device and Method of Controlling the Same

ABSTRACT

An imaging device receives from a host device image data and commands including a normal command and a real-time command to be processed prior to the normal command. A receiver receives a real-time processing disable command from the host device, and a processor processes the image data without processing the real-time command, even if the real-time command is included in the image data, after processing the real-time processing disable command. A method for so controlling an imaging device is also provided. The host controls transmission of image data and commands including normal and real-time commands as noted above to an imaging device. The host device comprises a detector that determines if data to be transmitted includes image data, and a processor that transmits the image data after transmitting a real-time processing disable command, if the detector determines that the data includes the image data.

CONTINUING APPLICATION DATA

This application is a continuation of, and claims priority under 35U.S.C. §120 on, application Ser. No. 12/892,507, filed Sep. 28, 2010,which is a divisional of application Ser. No. 11/955,289 (now U.S. Pat.No. 7,826,075), filed Dec. 12, 2007, which is a continuation ofapplication Ser. No. 11/064,895 (now U.S. Pat. No. 7,324,222), filedFeb. 24, 2005, which is a divisional of application Ser. No. 09/528,581(now U.S. Pat. No. 6,906,811), filed Mar. 20, 2000. This applicationalso claims priority under 35 U.S.C. §119 on Japanese patent applicationnos. 11-074000 and 11-074001, both filed Mar. 18, 1999, and on Japanesepatent application no. 11-104237, filed Apr. 12, 1999. The content ofeach application identified above is incorporated by reference herein inits entirety.

BACKGROUND OF THE INVENTION

1. Field of the Invention

The present invention relates to the operation of the imaging device,e.g., a printer, in processing a data stream containing bit-map data andcommands.

2. Description of the Related Art

Printers as the term is used in this text include all types of printingapparatuses used for printing text and/or graphics on various types ofprinting material such as paper. Typically, a printer is connected to oran integral part of some kind of information processing apparatus(simply referred to as host device or host computer hereinafter) thatcontrols the printer by sending to the printer a stream of dataincluding data that represent text and graphics to be printed as well ascontrol commands for controlling the printer itself.

The data sent from a host device to a printer can be regarded as a bitstream as well as a byte stream. Control commands are often composed ofbytes, i.e., units of 8 bits, and, in many cases, of multiple bytes.Normally, a command is composed of a command identifier, one or morecommand parameter bytes following the command identifier when needed,and additional command data when needed. There are two main commandtypes, a first or normal command type and a second command type, theso-called “real-time commands”. Normal commands are typically processedin the FIFO (first-in-first-out) order in which the printer receivesthem. Real-time commands are high priority commands that are processedwith precedence over normal commands as is described in detail in EP-A-0769 737. Real-time commands and normal commands can be distinguishedfrom one another by means of the respective command identifiers.

An interface in the printer is provided to connect to and allowcommunication with a host device. When the interface receives one ormore bytes of data, a receive interrupt is issued and invokes aparticular interrupt process. This interrupt process comprises:

(1) Detecting whether or not a real-time command has been received andimmediately executing the process corresponding to the real-time commandif a real-time command has been received; and

(2) Storing the received data in a receive buffer.

When the interrupt process is completed, the printer returns to thenormal processing. In general, the interrupt process is carried outrepeatedly until a CR (carriage return) is received or the receivebuffer becomes full. In the normal processing, a data stream stored inthe receive buffer is interpreted and, in accordance with theinterpreted data, a print image (bit map) is generated and written intoa print buffer. The data in the receive buffer are processed in a FIFO(first in, first out) order. Real-time commands are processedimmediately overriding the FIFO order. When the normal processingdetects a real-time command in the receive buffer, this command isignored because it has already been executed in the real-time processingmentioned above.

A data stream for printing text typically contains the byte values ofthe ASCII codes of the characters to be printed. On the other hand, adata stream for printing images/graphics, for loading a user-definedfont into the printer or the like, is typically composed of so-called“image data” representing each pixel or dot of an image/graphic or of acharacter by one bit to express black and white or multiple bits if morethan two colors are to be expressed. When a bit stream of such imagedata is thought of as a byte stream, the value of each byte in thestream is not restricted to a value of any of the ASCII codesrepresenting characters. In contrast to this, in decimal notation, eachvalue between 0 and 255 is possible, and there is no restrictionregarding possible combinations of byte values in such image datastream.

For this reason, an image data stream can happen to include what will bereferred to as “false real-time command” hereinafter, namely a datasequence identical to the byte stream of a (true) real-time command. Ifthe printer interprets such data sequence as a real-time command, thefalse real-time command is carried out even though in fact the datasequence was not meant to be a real-time command. Execution of a falsereal-time command can cause a variety of problems. For instance, as aresult of the execution of the false real-time command the printer mightsend data to the host computer, which is not ready to receive the data.

SUMMARY OF THE INVENTION

One aspect of the invention provides an imaging device adapted toreceive from a host device image data and commands including a normalcommand and a real-time command to be processed prior to the normalcommand. The imaging device comprises a receiver configured to receive areal-time processing disable command from the host device, and aprocessor configured to process the image data without processing thereal-time command, even if the real-time command is included in theimage data, after processing the real-time processing disable command.

Preferably, the receiver is further configured to receive a real-timeprocessing enable command from the host device; and the processor isfurther configured to process the real-time command received from thehost device, after processing the real-time processing enable command.

Another aspect of the invention is embodied in a method of controllingan imaging device adapted to receive from a host device image data andcommands including a normal command and a real-time command to beprocessed prior to the normal command. The method comprises: (a)receiving a real-time processing disable command from the host device;(b) after step (a), processing the real-time disable command; and (c)after step (b), processing the image data without processing thereal-time command, even if the real-time command is included in theimage data.

The method may further comprise: (d) after step (c), receiving areal-time processing enable command from the host device; (e) after step(d), receiving the real-time command from the host device; and (f) afterstep (e), processing the received real-time command.

Still another aspect of the invention is directed to a host deviceadapted to control transmission of image data and commands including anormal command and a real-time command to be processed prior to thenormal command. The host device comprises a detector configured todetermine if data to be transmitted to an imaging device includes imagedata; and a processor configured to transmit the image data to theimaging device after transmitting a real-time processing disable commandto the imaging device, if the detector determines that the data includesthe image data.

Preferably, the processor is further configured to transmit thereal-time command to the imaging device after transmitting a real-timeprocessing enable command to the imaging device, if the detectordetermines that the data does not include the image data.

Other objects and attainments together with a fuller understanding ofthe invention will become apparent and appreciated by referring to thefollowing description and claims taken in conjunction with theaccompanying drawings.

BRIEF DESCRIPTION OF THE DRAWINGS

In the drawings, wherein like reference symbols refer to like parts:

FIG. 1 is a block diagram showing the outline of a printer according tothis invention;

FIG. 2 is a flow chart of a receive interrupt process in a printeraccording to a first embodiment of the invention;

FIG. 3 is an explanatory illustration of state transitions of thereceive interrupt process in FIG. 2;

FIG. 4 is a flow chart showing the outline of a normal processing inprinter corresponding to the interrupt process in FIG. 2;

FIG. 5 is a block diagram showing the outline of a host computeraccording to the invention;

FIG. 6 is a flow chart showing a process implemented in the hostcomputer;

FIG. 7 is a flow chart of a receive interrupt process in a printeraccording to a second embodiment of the invention;

FIG. 8 is an explanatory illustration of state transitions of thereceive interrupt process in FIG. 7;

FIG. 9 is a flow chart of a receive interrupt process in a printeraccording to a third embodiment of the invention;

FIG. 10 is a flow chart showing a normal processing in the printercorresponding to the interrupt process in FIG. 9;

FIG. 11 is a flow chart showing a process implemented in the hostcomputer;

FIG. 12 is a flow chart of a receive interrupt process in a printeraccording to a fourth embodiment of the invention;

FIG. 13 is an explanatory illustration of state transitions of thereceive interrupt process in FIG. 12; and

FIG. 14 is a flow chart showing a normal processing in the printercorresponding to the interrupt process in FIG. 12.

DESCRIPTION OF THE PREFERRED EMBODIMENTS Basic Structure of Printer

FIG. 1 is a block diagram of a printer embodying the present invention.The printer, generally denoted as 101, is connected through an interface102 to a host computer 120 (an information processing apparatus), andincludes, as principal components, a CPU (Central Processing Unit) 103,a RAM 104, a ROM 105, a nonvolatile memory 106, and a printing mechanism107. ROM 105 stores control programs to be executed by the CPU tocontrol the printer. RAM 104 serves as a working memory of the CPU.Certain parts of the RAM are used for particular purposes such as areceive buffer 111, a print buffer 112, a state memory 113, a flagmemory 114 and, where required, a counter 115. Typically, the receivebuffer 111 is organized as a ring buffer. The nonvolatile memory 106 isan EEPROM (Electrically Erasable Programmable ROM) or a flash memory,for instance. Part of this nonvolatile memory 106 serves as a statusinformation memory 116 for storing status information of the printer tobe sent to the host computer 120 in response to a status request fromthe host computer 120. It is to be noted that, depending upon theparticular field of application of a printer, the nonvolatile memory 106is not always required and is not essential to the practice of thepresent invention.

When the interface 102 receives data from the host computer 120, areceive interrupt is generated that causes the CPU 103 to start areceive interrupt process by which the received data is written into thereceive buffer 111. In this interrupt process, when the CPU identifies areal-time command among the data received, it carries out a real-timeprocess corresponding that command, unless this is disabled. In additionthe received data whether or not it represents a real-time command orpart of it is written into the receive buffer 111. When the interruptprocess is finished, the control of the CPU 103 returns to the normalprocessing.

In the normal processing, the CPU 103 interprets a data stream stored inthe receive buffer 111 as print commands or a printer setting commands,retrieves font data from memory (ROM 105) as required and generates aprinting image (a bit map representation of the text or graphic to beprinted) in the print buffer 112. The way in which the printing image isgenerated based on the data received from the host computer and fontdata stored in the printer is well known so that further details will beomitted here. When the printing image in the print buffer 112 reaches apredetermined size, for instance, one line, the printing mechanism 107is driven in accordance with the printing image so that characters orgraphics are printed on a printing medium such as paper.

Furthermore, if a data stream in the receive buffer 111 is a fontdefinition command (a command transmitting font data that representuser-defined characters), the font data is stored in the RAM 104 (notethat the font data of such font definition command are image data asthis term is been defined above). The contents of the nonvolatile memory106 is updated in accordance with the font definition command.

First Embodiment Interrupt Process in Printer

FIG. 2 is a flow chart of the receive interrupt process in printer 101according to a first embodiment of the invention. This interrupt processbegins when the interface 102 of the printer 101 receives data from thehost computer 120. The following description of all embodiments assumesthat an interrupt invoking the receive interrupt process in generatedwhenever the interface 102 receives one byte of data. It goes withoutsaying that a similar process applies to the case in which the interruptis generated whenever the interface receives any predetermined number ofbytes. Whether the interrupt is generated in response to one, two ormore bytes being received by the interface is not critical to thepractice of the present invention.

For an easier understanding of the principles of the present inventionthis and the following embodiments will be explained with reference tocertain commands as defined below.

Normal Commands:

1) ESC * m nL nH d1 . . . dk: this is an image print command used tosend image data representing a bit map image (where parameter m is afixed value, nL and nH designate the number k=(nH·256+nL) of bytes ofimage data to follow, and d1 . . . dk are the bytes of image data). Thiscommand makes the printer print a graphic represented by the image data.

2) ESC & s n m a d1 . . . dk: this is a font definition command used tosend font image data representing user-defined characters to the printer(where s specifies the number of bytes in the vertical direction, aspecifies the number of dots in the horizontal direction, n designatesthe first character code in a sequence of user-defined characters, mdesignates the last character code, and d1 . . . dk are the bytes ofimage data defining the character(s)).

3) FSg1 m a1 a2 a3 a4 nL nH d1 . . . dk: this command is used forsending image data to be written in a user-defined nonvolatile memory(where m=0, a1-a4 designate the start address at which the data are tobe stored, nL and nH designate the number k=nH·256+nL bytes of imagedata to be stored, and d1 to dk are the bytes of image data).

Each of the commands 1) to 3) defined above transmits image data to theprinter. As representatives of commands that transmit image data to aprinter these commands will also be collectively referred to as “imagedata commands”.

Real-Time Commands:

The byte streams of the following real-time commands are expressedthrough the use of the mnemonics of the ASCII code.

1) “DLE EOT NUL”: this command makes the printer send status informationto the host computer.

2) “DLE EOT BEL”: this command makes an ink jet printer send ink statusinformation to the host computer.

3) “DLE EOT BS”: this command makes a printer equipped with an MICR(Magnetic Ink Character Recognition) function send status informationregarding the MICR function to the host computer.

4) “DLE ENQ”: A real-time request requesting the printer to perform acertain action.

5) “DLE DC4 SOH”: This command makes the printer output a pulse at acertain pin of a certain connector. The pulse can be used to control aperipheral device connected to the printer, for instance.

6) “DLE DC4 STX”: This command makes the printer turn off the powersupply.

7) “DLE DC4 BS”: This command makes the printer clear the receivebuffer.

8) “DLE EOT EOT”: This command makes the printer disregard real-timecommands for a predetermined period of time (for example, 1 second)(also referred to as RTP (real-time processing) disable command).

As described above, the interrupt process starts when the interface 102receives data from the host computer 120. After starting, the CPU 103first writes the received byte into the receive buffer 111 (step S201).Subsequently, the CPU 103 checks whether an RT flag stored in the flagmemory 114 is set or not (step S202) (while it is assumed here that theRT flag is set to indicate that the real-time processing is presentlyenabled and cleared (not set) to indicate that the real-time processingis presently disabled, it could just be opposite). When the RT flag isnot set (Yes at step S202), i.e., the real-time processing is disabled,the interrupt process comes to an end. As will be understood, in thisembodiment the flag memory 114 is used as an indication deviceindicating either an enabled state (RT flag is set) or a disabled state(RT flag is not set).

If the RT flag is set (No at step S202), the CPU 103 reads a valuestored in state memory 113. As will be explained in more detail later,this value indicates the receive status, more particularly, it indicateswhether or not a real-time command is currently being received. After ithas determined the current receive status, the CPU 103 updates the valuein the state memory 113, if required, on the basis of the value of thebyte received in step S201 and performs a real-time processing, ifrequired, as will be explained with reference to a state transitiondiagram shown in FIG. 3 (step S204). The interrupt process is thenterminated.

FIG. 3 is an explanatory diagram of state transitions during datareception. As will be appreciated by those skilled in the art, thisstate transition diagram (like those explained later) depends upon thestructure of the real-time commands use in a particular case. Thediagram in FIG. 3 is based on the real-time commands defined above.

In FIG. 3, a state A signifies that the byte received last, i.e., in theimmediately preceding interrupt process, did not belong to a real-timecommand. In state A, when the value of the byte received in step S201corresponds to DLE indicating the first byte of a real-time command,shifting takes place to a state B.

State B, thus, signifies that the byte received last was the first byteDLE of a real-time command. If state B is detected in step S203, thefollowing state transition (and, thus, the updating in step S204) takesplace in accordance with the value of the byte received in step S201:

if the byte corresponds to EOT, shifting to a state C is performed;

if the byte corresponds to ENQ, the real-time command DLE ENQ isexecuted and subsequently shifting to state A is performed;

if the byte corresponds to DC4, shifting to a state D is performed; and

if the byte corresponds to none of EQT, ENQ and DC4, the byte streambeing received is not a real-time command, and shifting to state A takesplace.

State C signifies the two last received bytes correspond to a real-timecommand beginning DLE EOT. If state C is detected in step S203, thefollowing transition takes place in accordance with the value of thebyte received in step S201:

if the byte corresponds to NUL, the real-time command DLE EOT NUL isexecuted (status information is sent to the host computer 120) and,subsequently, shifting to state A is performed;

if the byte corresponds to BEL, the real-time command DLE EOT BEL isexecuted (ink status information is sent to the host computer 120) and,subsequently, shifting to state A is performed;

if the byte corresponds to BS, the real-time command DLE EOT BS isexecuted (MICR status information is sent to the host computer 120) and,subsequently, shifting to state A is performed;

if the byte corresponds to EOT, the real-time command DLE EOT EOT isexecuted and, subsequently, then shifting to state A is performed(execution of DLE EOT EOT comprises clearing the RT flag in the flagmemory 114, and setting a timer to set the RT flag in a timer interruptprocess after lapse of a predetermined period of time (for example 1second) from the moment the time is set); and

if the byte corresponds to none of NUL, BEL, BE and EOT, the byte streambeing received is not a real-time command, so that shifting to state Ais performed.

State D means the two last received bytes correspond to a real-timecommand beginning DLE DC4. If state D is detected in step S203, thefollowing transition takes place in accordance with the value of thebyte received in the step S201:

if the byte corresponds to SOH, the real-time command a real-time DLEDC4 SOH is executed (a designated pulse is output), and then shifting tostate A is performed;

if the byte corresponds to STX, the real-time command a real-time DLEDC4 STX is executed, i.e., the power supply of the printer is turnedoff;

if the byte corresponds to BS, the real-time command a real-time DLE DC4BS is executed (the receive buffer 111 and the print buffer 112 arecleared), and then shifting to state A is performed; and

if the byte corresponds to none of SOH, STX and BS, the byte streambeing received is not a real-time command, so that shifting to state Ais performed.

As described above, whenever a receive interrupt is generated, a checkis made as to whether or not the real-time processing is disabled. Thetime needed for this check is on the order of several microseconds.Because of a relatively simple state transition processing describedabove, only a short time is required for the receive interrupt process.

Normal Processing in Printer

The normal processing is for interpreting and printing the data theprinter 101 receives. FIG. 4 is a flow chart of such normal processing.As will be understood by those skilled in the art, this normalprocessing can be interrupted any time by the interrupt process of FIG.2 in response to a receive interrupt.

Incidentally, as long as unprocessed data remain in the receive buffer111, the CPU 103 obtains and processes that data, while, when no dataremain, it waits until new data is written into the receive buffer 111through the foregoing interrupt process. In this way, aquasi-multitasking processing is implemented. In the followingdescription, for simplicity, the process for retrieving one byte fromthe receive buffer 111 and the repeated processes for retrievingmultiple bytes from the receive buffer 111 will together be referred toas “obtaining” data from the receive buffer. In addition, in thisembodiment, a command for enabling the real-time processing isimplemented as a normal command.

First of all, the CPU 103 obtains data from the receive buffer 111 (stepS401), and checks the kind of that data (step S402). If the datarepresent a command to enable real-time processing (step S402; RTPenable), the CPU 103 sets the RT flag in the flag memory 114 (stepS403), and the procedure returns to step S401. On the other hand, if thedata represent a normal command other than the command to enablereal-time processing (step S402; normal), the CPU 103 carries out theprocessing corresponding to that command (step S404). This processingincludes printing of text or graphics, printing of images, and storingthe font data of a font definition command. If the processing iscontinued (step S405; Yes), the procedure returns to step S401.

If the data obtained in step S401 represent a real-time command (stepS402; RTC) and if the processing is continued (step S405; Yes), theprocedure returns to step S401. This means, the real-time command is notexecuted because it has already been executed, in the receive interruptprocess. Each image print command has a parameter that indicates thelength of image data. The parameter follows in the command symbol of theprint command. According to the format of the command, the host sendsimage data after the parameter indicating the data length. Therefore,when CPU in the printer interprets an image print command, it can alsoread the length of the data at substantially same time.

If the obtained data is the image data command in step S402 in FIG. 4CPU (printer side) repeats to read the image data from the receivebuffer and write it to the print buffer in accordance with determinedcycle by the parameter. Therefore, if a false RTC is included in theimage data, it is sent to the print buffer in step S404.

If the receive interrupt processing and the normal processing areprovided in this way, when the host computer 120 intends to send to theprinter a data stream of a normal command (for example, an image printcommand or a font definition command) including, in the commandparameter and command data stream following the command identifier, afalse real-time command, it first sends an RTP disable command, thenthat normal command and finally an RTP enable command. This makes itpossible to prevent the real-time processing from being executed inresponse to a false real-time command included accidentally in a normalcommand.

Host Computer

FIG. 5 is a block diagram showing a host computer according to thisinvention.

The host computer 120 is controlled by a CPU 501. Upon turning-on of apower supply to the host computer 120, the CPU 501 can carry out an IPL(Initial Program Loader) stored at a predetermined location in a ROM 502for beginning the processing, and further can run programs stored in anonvolatile storage device 503 such as a hard disk, a floppy disk, or aCD-ROM (Compact Disk ROM). In running the programs, a RAM 504 is used asa temporary storage device. In addition, the host computer 120 can beequipped with an input unit (not shown), such as a keyboard or a mouse,and a display unit (not shown).

During execution of application programs for printing text or graphics,a data stream of a print command is fed through an interface 505 to aprinter. FIG. 6 is a flow chart showing the process for sending suchdata stream of a normal command to the printer to make the printer printtext or graphics in accordance with the data or store the data as fontdata. This process is generally implemented by a program called aprinter driver, which is installed in the host computer from a recordingmedium, such as a floppy disk. The process starts, for example, inresponse a print request from an application program to the operatingsystem.

First, the CPU 501 checks whether or not the data stream of a normalcommand to be sent includes a false real-time command (step S601). Ifthis is not the case (step S601; No), the CPU 501 sends the data stream(step S602), and then terminates this process. On the other hand, if afalse real-time command is included (step S601; Yes), the CPU 501 sendsan RTP (real-time processing) disable command (step S603), subsequentlysends the data stream of that normal command, and then sends an RTPenable command (step S605). This processing is then terminated.

A byte stream representing such normal command can be quite long. If theRTP disable command is sent to precede such long byte stream and the RTPenable command is sent to follow the byte stream, the real-timeprocessing in the printer may be disabled for a correspondingly longtime. This can be avoided by dividing the byte stream into individualblocks. For example, for printing of an image, a decision is made as towhether the volume (e.g., the number of bytes (or bits)) of that normalcommand is such that the printer can process it within a predeterminedtime (for example, 1 s). If yes, steps S603 to S605 are executed asdescribed. On the other hand, if the predetermined number is exceeded,that normal command is divided into a plurality of shorter normalcommands. Steps S603 to S605 are then executed separately for each ofthe shorter normal commands. Between the end of one sequence of stepsS603 to 605 and the begin of the next sequence of the same steps, acheck is made as to whether a real-time command to the printer isnecessary or not, and if necessary, that real-time command is sent out.With such processing, the maximum waiting time for a real-time commandto be executed in the printer is only the aforesaid predetermined time(1 s) in the case of a real-time processing needed.

Incidentally, the decision as to whether or not a normal command can beprocessed in the printer within the predetermined time can rely simplyon the comparison of the number of bits or bytes of the normal commandwith a predetermined value.

Second Embodiment Interrupt Process in Printer

FIG. 7 is a flow chart of the receive interrupt process in a printer 101according to a second embodiment of this invention. This secondembodiment differs from the first one by employing a different RTPdisable command instead of the RTP disable and RTP enable commands inthe first embodiment. The RTP disable command in this embodiment iscomposed of a three bytes command identifier and a two bytes commandparameter, and is thus 5 bytes in total:

“DLE EOT EOT n m”: this signifies that real-time processing of thesubsequent k=n·256+m bytes is to be disabled.

A counter 115 required in the printer of this second embodiment can beimplemented by means of a certain part of RAM 104 (in cooperation withthe CPU 103).

Steps S701, S702 and S703 in FIG. 7 are virtually the same as stepsS201, S202 and S203, respectively, in FIG. 2. Step S704 in FIG. 7differs from step S204 in FIG. 2 only in that the processing in stepS804 is in accordance with the state transition diagram if FIG. 8instead of that in FIG. 3. Most of the state transition diagram in FIG.8 is identical to the state transition diagram shown in FIG. 3, howeverit differs in processing when EOT is received in the state C. When thebyte received in step 701 corresponds to EOT and step S703 indicatesstate C, shifting to a state X takes place.

When the interrupt process is then invoked again and step S703 indicatesstate X, the counter mentioned above is preset to the value n·256 wheren is the value of the byte received in step 701. Subsequently, and stillas part of step S704, shifting to a state Y takes place. When theinterrupt process is then invoked again and step S703 indicates state Y,m is added to the count value of the counter 115, the RT flag in theflag memory 114 is cleared, and then shifting to state A takes place.

If the RT flag is not set in step S702 indicating that real-timeprocessing is disabled (step S702; Yes), the count value of counter 115is decremented by one (step S705), and a check is made as to whether ornot the decremented count value is still greater than zero (step S706).If it is greater than zero (step S706; Yes), this interrupt processcomes to an end. If the count value is not greater than zero (step S706;No), the RT flag in the flag memory 114 (step S707) is set, and thenthis interrupt process terminates

According to this second embodiment, since the RTP disable commandallows setting the duration while it is effective in terms of a numberof bytes, there is no need for an RTP enable command. When the hostcomputer needs to send, as a normal command, a byte stream that includesa false real-time command, it first sends the RTP disable command whosecommand parameters n and m are set to correspond to the length of thenormal command byte stream to be send, and then sends that normalcommand byte stream. The possibility of dividing such normal commandinto a plurality of shorter normal commands as explained in the contextof the first embodiment applies to this second embodiment in the sameway.

If false real-time commands embedded in a data stream of a normalcommand are not expected to occur very often, because the image printcommand is rarely used, for instance, and it is mainly during loading auser-defined font into the printer that a false real-time command mayoccur, it is possible to use a hardware element rather than flags in aflag memory, e.g., as a dip switch, as an indication device indicatingthe enabled or disabled state for the execution of the real-timeprocessing.

Third Embodiment Interrupt Process in Printer

Of a plurality of real-time commands, in fact, there are some which donot create a problem even if being executed in the middle of an imagedata stream.

Additionally, in a case in which the printer is part of a POS (Point OfSale) system and the image data represent a logo of the store in whichthe POS system is installed, the data can be prepared in advance so asnot to be almost indistinguishable from real-time commands, and in sucha case, for example, when a status request is made from an applicationprogram, the transmission of a real-time command therefor does notcreate a problem. For such case, the following command is defined as anormal command to disable and enable the real-time commandsindividually:

GS (D m n: “GS (D” is the command identifier, and m and n are commandparameters; m is used to specify real-time commands and n is used toenable/disable the specified command.

Assuming that, among the real-time commands, there are eight commands orless that one might wish to disable/enable. Parameter m represents onebyte, i.e., 8 bits. Each of the 8 bits corresponds to a respective oneof the eight or less real-time commands. If, in binary notation, m is10000011, the first, the seventh and the eighth command are an object ofthe disable/enable control, i.e., “1” selects a command and “0”deselects it. If, again in binary notation, the parameter n is 10000010,the first and the seventh command are enabled while the eighth commandis disabled, i.e., “1” enables while “0” disables. Whenever the CPUidentifies this normal command, it sets or resets RT flags for theindividual real-time commands in the flag memory 114 in accordance withthe parameters m and n. When the RT flag for a particular real-timecommand is set, the command is enabled and otherwise it is disabled.

FIG. 9 is a flow chart of the receive interrupt process in a printer 101according to a third embodiment of this invention making use of the RTPdisable/enable command GS (D m n. Steps S901 and S903 in the interruptprocess shown in FIG. 9 are the same as steps S201 and S203,respectively, in FIG. 2. Steps S202 and S204 in FIG. 2 are replaced bysteps S903 to S906 in FIG. 9.

After it has determined the current receive status in step S902, the CPU103 updates the value in the state memory 113, if required, on the basisof the value of the byte received in step S901 and in accordance with astate transition diagram similar to that shown in FIG. 3 (step S903). Inperforming the state updating, the CPU 103 decides whether or not thereis a need to perform a real-time processing (step S904), i.e., whetheror not the byte received in step S901 is the last byte of a real-timecommand. If the real-time processing is necessary (step S904; Yes), theCPU 103 checks the RT flags in the flag memory 114 to make a decision asto whether the particular real-time command is presently disabled (stepS905). If it is not disabled (step S905; No), the processingcorresponding to the real-time command is carried out (step S906). If itis disabled (step S905; Yes), this interrupt process terminates withoutreal-time processing.

This checking whether or not a particular real-time command is disabledwhenever a data stream representing a real-time command is received,requires a time on the order of several microseconds. Thus, because ofthe relatively simple state transition processing, only a short time isrequired for the receive interrupt process.

Although the foregoing processing is based on state transitions similarto the state transition diagram shown in FIG. 3, there are differencesin detail. That is:

1) when the byte received in step S901 corresponds to EOT while stepS902 indicates state C, the processing of shifting to the state A doesnot take place; and

2) in this third embodiment, the each real-time command can beindividually disabled/enabled, and when a disabled real-time command isreceived, instead of executing the command and then shifting to state A,only state shifting to state A takes place.

Normal Processing in Printer

FIG. 10 is a flow chart of the normal processing in the printer 101according to the third embodiment. This normal processing issubstantially the same as that of the first embodiment and only thedifferences will be explained below.

Steps S1001, S1002, S1004 and S1005 in FIG. 10 are virtually the same assteps S401, S402, S404 and S405, respectively, in FIG. 4. Differencesare due to the fact that, in this embodiment, a single normal RPTdisable/enable command is used for disabling and for enabling thereal-time processing as has been explained above. Thus, if the dataobtained in step S1002 represent this RTP disable/enable command (stepS1002; RTC disable/enable), the CPU 103 sets or resets an RT flag in theflag memory 114 for every real-time command (step S1003), and checkswhether the processing should be continued or not (step A1005). Ifcontinued (step S1005; Yes), the procedure returns to the step S1001.

With the receive interrupt process and the normal processing asdescribed above, when the host computer 120 intends to send to theprinter a stream of data including a false real-time command asexplained above, it first sends the RTP disable/enable command todisable the real-time command(s) involved, then sends the data streamand finally sends the RTP disable/enable command again to enable thereal-time command(s) disabled before.

Host Computer

The structure of the host computer of this embodiment of the inventionis the same as that shown in FIG. 5 and described above. FIG. 11 is aflow chart of the process in the host computer 120 executed for sendingto the printer a stream of data of a normal command such as an imageprint command or a font definition command. The process illustrated inFIG. 11 is similar to that of the first embodiment shown in FIG. 6. Thedifferences will be explained below.

Steps S1101, S1102, S1103, S1106 and S1107 are the same as steps S601,S602, S603, S604 and S605, respectively, in FIG. 6, except that thecommands sent in steps S1103/S1107 are different from the commands sentin steps S603/S605.

More particularly, in step S1103 the CPU 501 sends the RTPdisable/enable command in a command disabling condition (step S1103).Subsequently, it sends, of the normal commands implemented in theprinter 101, a status request command requesting the printer to returnstatus information (step S1104). The CPU 501 waits for the statusinformation to be returned by the printer 101 (step S1105), and afterreceiving the status information, it sends the data stream of thatnormal command (step S1106), and finally sends the RTP disable/enablecommand in an enabling condition (step S1107). This process is thenterminated.

The reason why the status request command is sent in step S1104 and theprocedure then waits for the status information in step S1105 is asfollows.

There is a possibility of the occurrence of a time difference from whenthe printer 101 receives an RTP disable/enable command until thiscommand is executed and the RT flags in the printer's flag memory areset correspondingly. For example, if an RTP disable/enable command fordisabling a particular real-time command is sent and a data streamaccidentally including the corresponding false real-time command is sentimmediately after the RTP disable/enable command, the command to bedisabled may in fact be executed. Therefore, the printer 101 has afunction whereby its own status including the RT flags is stored in amemory as status information and is sent in response to a status requestcommand from the host computer. Hence, through the use of this function,it is possible to verify whether the instructed setting of the RT flagsis carried out or not.

As explained before, when the printer 101 receives the RTPdisable/enable command, it updates the RT flags in the flag memory 114as well as in the status information memory 116. In step S1104,execution of that processing is reported to the host computer in amanner such that status information including these flags is sent inresponse to the status request command from the host computer. Thus, itis possible to positively confirm that the RTP disable/enable commandhas been executed. The command requesting the status of the RT flags canbe a dedicated command, but can also be a general-purpose command to besent together with other status data depending on the contents of thestatus data.

In addition, in this embodiment, since the RT flags can be setindependently for each real-time command, if a command which is notcarried out in the middle of the normal processing, such as the commandfor turning off the power supply to the printer, is normally disabledand enabled immediately before it is needed (before the power supply isto be turned off), it is possible to simplify the process in the hostcomputer of checking whether or not false real-time commands areincluded in the data stream of a normal command to be sent to theprinter.

Fourth Embodiment Receive Interrupt Process in Printer

FIG. 12 is a flow chart of the receive interrupt process in a printeraccording to a fourth embodiment of this invention. In this embodiment,as well as the first embodiment shown in FIG. 2, the interrupt processstarts when the interface 102 (see FIG. 1) of the printer 101 receives abyte from the host computer 120, and the same or corresponding portionswill be omitted from the following description. In addition, as with theembodiment shown in FIG. 2, this embodiment employs the normal commandsdefined as 1) to 3) in the description of the first embodiment andactually processes them as RTP disable commands.

Upon the start of the interrupt process, the CPU 103 puts the bytereceived by the interface 102, into the receive buffer 111 (step S2010).

Following this, the CPU 103 checks the flag memory 114 to decide whetheror not the real-time processing is currently disabled (step S2020). Ifno image data command has been received so far, the RT flag indicatingwhether the real-time processing is enabled or disabled is in an initialcondition, i.e., it is set, which means real-time processing is enabled.

If the real-time processing is not disabled (step S2020; No), ananalysis is made as to whether or not the received byte is the last oneto complete a real-time command (step S2030). If it is, a predeterminedreal-time processing in accordance with the real-time command isexecuted (step S2100), and then this process comes to an end. Ifreal-time processing is disabled, the procedure skips this real-timeprocessing.

Furthermore, if the answer in step S2030 is No, i.e., the received bytedoes not complete a real-time command, an analysis is made as to whetheror not an image data command has bee received (step S2040). If thedecision of this step indicates that an image data command has beenreceived (step S2040; Yes), the RT flag in the flag memory 114 iscleared (step S2120).

Subsequently, an analysis is made on whether the image data processinghas been completed or not (step S2050). If completed, the RT flag inflag memory 114 is set and the real-time processing enabled (stepS2110). Because a command parameter indicative of the length of commanddata precedes the image data command, this analysis is accomplished bychecking the data length on the basis of this command parameter.

The above-mentioned processing can cope with the case of accepting andprocessing a real-time command and the case of disabling this commandfor preventing malfunctions in the image data processing, withoutconflicting with each other.

FIG. 13 is an explanatory illustration of a state transition diagram inthe receive interrupt process of FIG. 12. States B, C and D and theconditions of transitions between states, that is, the conditions forthe transitions A-B, B-C, C-A, B-D, and D-A, are similar to thoseexplained in the context of FIG. 3, and the description thereof will beomitted for brevity.

A state e1 signifies the first byte (ESC) of an image data command ESC *or ESC & is being received currently. In the state A, if the value ofthe received byte is ESC, shifting to the state e1 takes place.Furthermore, in the state e1, if the value of the next received byteis * or &, shifting to a state E, which will be described later, takesplace. In the case other than this, shifting to state A takes place.

A state e2 signifies that the first byte (FS) of the image data commandFSg1 m is currently being received. In state A, if the received bytecorresponds to FS, shifting to the state e2 takes place.

A state e3 signifies that the second byte (g) of the command FSg1 m isbeing received. In state e2, if the received byte is g, shifting tostate e3 takes place. In a case other than this, shifting to state Atakes place. Furthermore, in state e3, if the value of the next receivedbyte is 1, shifting to state E takes place. In a case other than this,shifting to state A takes place.

The state E signifies that any of the image data commands ESC *, ESC &,and FSg1 m is currently being processed. In this state, the RT flag inthe flag memory 114 is cleared.

In the image data commands ESC *, ESC &, FSg1 m, since a commandparameter defines the data length of the image data to follow, aftershifting from state e1 or e3 to state E, the data stream indicative ofthe image data length, sent with ESC *, ESC &, and FSg1 m, is receivedsubsequently. In state E, the received value is set in the counter 115,and subsequently decremented by 1 with every byte received.

When the count value of counter 115 reaches zero, that is, at thecompletion of the reception of the image data, the RT flag in the flagmemory 114 is set, and the shifting from the state E to the state Atakes place.

As described above, in this embodiment, when the printer 101 receives animage data command, real-time commands are automatically disabled, andwhen the last byte of the image data command is received, the real-timecommands are enabled again; hence, it is not necessary to provide anextra command for disabling/enabling real-time commands.

On the other hand, in the host computer 120, even if a false real-timecommand is included in the data stream of an image data command, thereis no need to take any action like sending an RTP disable/enable commandin advance, which allows the image data to be sent more easily to theprinter.

Normal Processing in Printer

The normal processing is for interpreting and printing the data theprinter 101 receives. FIG. 14 is a flow chart of such normal processing.As will be understood by those skilled in the art, this normalprocessing can be interrupted any time by the interrupt process of FIG.12 in response to a receive interrupt.

Incidentally, as long as unprocessed data remain in the receive buffer111, the CPU 103 obtains and processes that data, while, when no dataremain, it waits until new data is written into the receive buffer 111through the foregoing interrupt process. In this way, aquasi-multitasking processing is implemented. In the followingdescription, for simplicity, the process for retrieving one byte fromthe receive buffer 111 and the repeated processes for retrievingmultiple bytes from the receive buffer 111 will together be referred toas “obtaining” data from the receive buffer. In addition, in thisembodiment, a command for enabling the real-time processing isimplemented as a normal command.

First of all, the CPU 103 obtains data from the receive buffer 111 (stepS4010), and checks that data (step S4020). If the data represents anormal command other than an image data command (step S4020; others),the processing corresponding to that command is executed (step S4210).If real-time command data stream is detected, it is skipped (Step S4200)since it has already been implemented in interrupt process (Step S2100).This processing includes, for example, printing of text or graphics,printing of images, registration of the font data of a font definitioncommand, and storage of predetermined data in the nonvolatile memory106. Then, if there is subsequent data (step S4130; Yes), the procedurereturns to the step S4010.

If the answer in step S4020 shows printing of images, after obtainingthe command parameter indicating the length of the data stream (stepS4030), the CPU 103 obtains the subsequent image data (step S4040) todevelop them in the print buffer 112 (step S4050). Additionally, the CPU103 confirms that the printing has not been canceled (step S4060). Ifthe answer in S4060 is “Yes”, the CPU 103 drives the printing mechanism107 to carry out the printing (step S4070), and clears the print bufferafter printing is completed.

Furthermore, if the decision of the step S4020 indicates a fontdefinition command, the CPU 103 obtains font description data (stepS4100), and obtains the subsequent font data representing theuser-defined font or characters (step S4110) and registers this data ina predetermined memory area (step S4120). Upon the completion of therespective processing, the CPU 103 confirms whether further data existsor not (step S4130). If not, the CPU 103 terminates this processing,otherwise the procedure returns to the step S4010 for continuing thisprocessing.

When the receive interrupt process and the normal processing areperformed in this way, and the host computer intends to send to theprinter a data stream of a normal command (for example, an image printcommand or a font definition command) which can include, as part of acommand parameter and command data stream, a false real-time command, itdeals with such a command as if it had an RTP disable command function,the printer enable RTP command at the end of the command data of thenormal command. Accordingly, it becomes possible to prevent thereal-time processing from being executed due to a false real-timecommand accidentally included in the normal command.

In all the above-described embodiments, the receiving/analyzingprocessing for receiving data, the real-time processing for carrying outreal-time commands, the normal processing for carrying out normalcommands, and the setting processing for setting flags are implementedin a control circuit of the printer preferably including a CPU, a RAM,and a ROM storing programs for operating the CPU, where a receiveprocessing section, a real-time processing section, a normal processingsection, and an indication section, are constructed with sets ofprograms and hardware. A portion of or all of each of these processingsections is also replaceable with gate arrays or hardware such as a DSP.

Although the programs of these processing sections are commonly storedin a ROM, it is also possible that they are stored on a magnetic storagemedium such as CD-ROM, an optical disk medium, and a web site, and areset in the printer from such medium.

As described above, according to this invention, the following effectsare obtainable.

First, it is possible to provide a printer and an information processingapparatus capable of performing processing in a state of distinguishinga false real-time command among image data from a true a real-timecommand.

Particularly, it is possible to provide a printer, an informationprocessing apparatus and a control method therefor, capable of, even ifthere is a normal command data stream which can include the same bytepattern as a real-time command, performing correct processing withoutthe need for the user to pay attention to this.

Since, in an embodiment of the invention, the disabling and enabling ofthe real-time processing can be set individually for each a plurality ofimplemented real-time commands, high-priority command processing such asa status request becomes practicable at all times, and it is possible tosurely perform the printing processing without impairing the functionsof the information processing apparatus side.

While the invention has been described in conjunction with severalspecific embodiments, it is evident to those skilled in the art thatmany further alternatives, modifications and variations will be apparentin light of the foregoing description. Thus, the invention describedherein is intended to embrace all such alternatives, modifications,applications and variations as may fall within the spirit and scope ofthe appended claims.

1. An imaging device adapted to receive from a host device image dataand commands including a normal command and a real-time command to beprocessed prior to the normal command, the imaging device comprising: areceiver configured to receive a real-time processing disable commandfrom the host device; and a processor configured to process the imagedata without processing the real-time command, even if the real-timecommand is included in the image data, after processing the real-timeprocessing disable command.
 2. The imaging device of claim 1, whereinthe receiver is further configured to receive a real-time processingenable command from the host device; and the processor is furtherconfigured to process the real-time command received from the hostdevice, after processing the real-time processing enable command.
 3. Amethod of controlling an imaging device adapted to receive from a hostdevice image data and commands including a normal command and areal-time command to be processed prior to the normal command, themethod comprising: (a) receiving a real-time processing disable commandfrom the host device; (b) after step (a), processing the real-timedisable command; and (c) after step (b), processing the image datawithout processing the real-time command, even if the real-time commandis included in the image data.
 4. The method of claim 3, furthercomprising: (d) after step (c), receiving a real-time processing enablecommand from the host device; (e) after step (d), receiving thereal-time command from the host device; and (f) after step (e),processing the received real-time command.
 5. A host device adapted tocontrol transmission of image data and commands including a normalcommand and a real-time command to be processed prior to the normalcommand, the host device comprising: a detector configured to determineif data to be transmitted to an imaging device includes image data; anda processor configured to transmit the image data to the imaging deviceafter transmitting a real-time processing disable command to the imagingdevice, if the detector determines that the data includes the imagedata.
 6. The host device of claim 5, wherein the processor is furtherconfigured to transmit the real-time command to the imaging device aftertransmitting a real-time processing enable command to the imagingdevice, if the detector determines that the data does not include theimage data.